// *************************************
// EFMP Fleet
// Master.do
// *************************************

/*
// Description
// ----------------------------
This program analyses the Enhanced Fleet Modernization Program (EFMP) in 
California.  It queries Experian EV sales data for new and used EVs and EFMP
rebate data.  After cleaning the data, it performs triple difference (TD) 
and regression discontinuity (RD) analyses, using moments of the fleet composition
as outcome variables. 
*/

/*** START CODE ***/


// Preamble
clear all
set more off


// Setup
// ----------------------------


** Set Data path globals
global Path 			""

global EFMPFleet 		"${Path}/EFMP_Fleet"
global EFMPFleetCode	"${EFMPFleet}/Code"
global EFMPFleetLog		"${EFMPFleet}/Log"
global EFMPFleetRes		"${EFMPFleet}/ResultsOut"
global EFMPFleetDraft	"${EFMPFleet}/Drafts"
global DisCommCode		"${EFMPFleet}/DisCommCode"
global EFMPFleetData	"${EFMPFleet}/Data"
global Experian 		"${Data}/Experian"
global CVRPData 		"${Data}/CVRP Incentives"
global MapFiles 		"${Data}/mapfiles"
global DisCommData 		"${Data}/DisCommData"

cd "${EFMPFleet}"

/* Data setup */

do "${EFMPFleetCode}/DataSetup.do"
	/*Tables A.6 */

/* Analysis */

do "${EFMPFleetCode}/summstat_plots.do"
	/*Figure 1: MPG distribution, Light-duty vehicles purchased in CA, 2015-2017*/
	/*Figure 2: Sales and mean fuel economy of purchased vehicles*/
	/*Figure 4: Fuel Economy of EFMP Vehicles*/
	/*Figure A.1: Number of zip codes within tract boundaries*/

do "${EFMPFleetCode}/Table1.do" 
	/*Table 1: EFMP Vehicle Fuel Efficiency (2015-2017)*/
	
do "${EFMPFleetCode}/Table4.do" 
	/*Table 4: Table 4: Implied CO2 savings (kg per EV per year) (Implied_CO2_savings.png)*/
		
do "${EFMPFleetCode}/EFMP_fleet_regs.do"
	/*Tables 2, 3, A.2, A.3, A.4, A.5 */
	

	/*Dawson_Mapping_20171021.R*/
	/*Figure 3: Map of EFMP pilot regions and Disadvantaged Zip Codes (map_Zoom_ZIPs_DACs_20171130.png)*/
	


/*** END CODE ***/


